|
|
|
|
|
|
|
The left side of Figure 5.7 shows an image of program FrmScale in action. On the right is a picture showing how the curve fits on a printed page. The dashed lines indicate where the edges of the form's drawing area are on the printed page. These pictures are drawn at the same scales as those in Figure 5.6. |
|
|
|
|
|
|
|
|
High Resolution PrintForm |
|
|
|
|
|
|
|
|
The PrintForm method is convenient, but it produces a low-resolution result. By examining the controls contained on a form, you can implement a set of routines that produce a high-resolution approximation of PrintForm. |
|
|
|
|
|
|
|
|
The idea is simple. Use the form's Controls collection to examine each of the controls on the form. Draw a high-resolution image of each control on the printer. While the basic idea is straightforward, there are many details to consider. |
|
|
|
|
|
|
|
|
First, different types of controls have different properties and appearances, so you need to draw them differently. Because several graphic properties do not apply to all controls, you need to consider them carefully. For example, picture boxes, labels, and text boxes have a BorderStyle property that you can use to decide whether to draw a box around the control. Option buttons, check boxes, and command buttons do not have this property, so you cannot look at it. If a program tries to look at a command button's BorderStyle property, Visual Basic raises an error. |
|
|
|
|
|
|
|
|
Second, a wide variety of properties affect the appearance of many controls. Drawing a multiline text box correctly can be difficult for different lengths of text, with and without scroll bars, and with different Alignment property values. |
|
|
|
|
|
|
|
|
Third, some controls may be contained in other controls. The containers may be contained in still other controls. If some of these controls are picture boxes, they may have their own |
|
|
|
|
|
|
|
|
Figure 5.7
Screen and printed output from program FrmScale. |
|
|
|
|
|